package com.wanczy.servlet;


import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.wanczy.service.UserLoginService;
import com.wanczy.service.impl.UserLoginServiceImpl;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

@WebServlet("/servlet/deleteUser")
public class DeleteUserServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		PrintWriter out = response.getWriter();
		int userId= Integer.parseInt(request.getParameter("userId"));
		UserLoginService service  = new UserLoginServiceImpl();
		boolean flag = service.doDel(userId);
		JSONArray jsonA = new JSONArray();
		JSONObject jsono = new JSONObject();
		jsono.put("flag", flag);
		jsonA.add(jsono);
		out.println(jsonA.toString());
		out.close();
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
